<template>
  <el-container>
    <el-aside width="200px">
      <el-menu  default-active="1" class="el-menu-vertical-demo">
        <el-menu-item index="1">
          <router-link to="/ListingBooks" class="menu-link">个人资料</router-link>
        </el-menu-item>
        <el-menu-item index="2">
          <router-link to="/ListingBooks" class="menu-link">聊天</router-link>
        </el-menu-item>
        <el-menu-item index="3">
          <router-link to="/ListingBooks" class="menu-link">查看行情</router-link>
        </el-menu-item>
        <el-menu-item index="4">
          <router-link to="/ListingBooks" class="menu-link">查看公告</router-link>
        </el-menu-item>
        <el-menu-item index="5">
          <router-link to="/Issue" class="menu-link">快捷咨询</router-link>
        </el-menu-item>
        <el-menu-item index="6">
          <router-link to="/UserOrder" class="menu-link">我的订单</router-link>
        </el-menu-item>
        <el-menu-item index="7">
          <router-link to="/ChatRoom" class="menu-link">聊天室</router-link>
        </el-menu-item>
        <el-menu-item index="8">
          <router-link to="/ListingBooks" class="menu-link" @click="logout">退出登录</router-link>
        </el-menu-item>
      </el-menu>
    </el-aside>

    <el-container>
      <el-header>
        <h1>用户管理系统</h1>
        <p>欢迎，{{ userName }}</p>
      </el-header>

      <el-main>
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
export default {
  name: "UserInterface",
  data() {
    return {
      userName: '张三',
      email: 'zhangsan@example.com',
      phone: '12345678901',
      activeIndex: '1', // 默认选中的菜单项
    };
  },
  methods: {
    logout() {
      // 处理退出登录逻辑
      this.$message('已退出登录');
    },
    editProfile() {
      // 编辑个人资料逻辑
      this.$message('跳转到修改资料页面');
    },
  },
};
</script>

<style scoped>
.el-header {
  background-color: #f2f2f2;
  padding: 20px;
  text-align: center;
}
.el-menu-vertical-demo {
  width: 200px;
  background: #f9f9f9;
}

/* 去除 router-link 的下划线和颜色 */
.menu-link {
  text-decoration: none; /* 去除下划线 */
  color: inherit; /* 继承父元素的颜色 */
}

/* 自定义hover效果 */
.menu-link:hover {
  color: #409EFF; /* 鼠标悬停时的颜色 */
}
</style>
